//
//  AccountCell.m
//  ImGuider
//
//  Created by llt on 2017/6/23.
//  Copyright © 2017年 imguider. All rights reserved.
//

#import "AccountCell.h"
#import <IQKeyboardManager.h>

@interface AccountCell ()

@property (weak, nonatomic) IBOutlet UIImageView *accountImageView;
@property (weak, nonatomic) IBOutlet UILabel *accountNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *accountContentLabel;
@property (weak, nonatomic) IBOutlet UILabel *accountCopyLabel;

@property (weak, nonatomic) IBOutlet UIImageView *selectTagImageView;

@property (weak, nonatomic) IBOutlet UILabel *redLabel;


@end

@implementation AccountCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.accountCopyLabel.text = MYLocalizedString(@"CONTACT_COPY", nil);
    
    
    
    
    self.redLabel.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10);
}

- (void)configWithDict:(NSDictionary *)dict {
    
    self.accountImageView.image = [UIImage imageNamed:dict[@"image"]];
    self.accountNameLabel.text = MYLocalizedString(dict[@"name"], nil);
    
    self.accountContentLabel.text = dict[@"account"];
    
    if ([dict[@"image"] isEqualToString:@"提问"]) {
        
        
        if ([[UserManager sharedManager].user.unread integerValue] > 0) {
            self.redLabel.hidden = NO;
            
            self.redLabel.text = [UserManager sharedManager].user.unread;
        } else {
            
             self.redLabel.hidden = YES;
        }
        
        
    } else {
        self.redLabel.hidden = YES;
    }
}

- (void)setChoosed:(BOOL)choosed {
    
    _choosed = choosed;
    
    if (choosed) {
        self.selectTagImageView.image = [UIImage imageNamed:@"button_tick_sel"];
    } else {
        self.selectTagImageView.image = [UIImage imageNamed:@"button_option_nor"];
    }
    
}

@end
